#include "httpconn.h"

const char* HttpConn::srcDir;
std::atomic<int> HttpConn::userCount;
bool HttpConn::isET;

HttpConn::HttpConn() {

}

HttpConn::~HttpConn() {

}

int HttpConn::GetFd() const {
    return m_fd;
}

void HttpConn::Close() {

}

int HttpConn::Read(int* readerrorno) {
    char buff1[10] = {0};
    char buff2[10] = {0};
    struct iovec iov[2];
    iov[0].iov_base = buff1;
    iov[0].iov_len = sizeof(buff1);
    iov[1].iov_base = buff2;
    iov[1].iov_len = sizeof(buff2);   

    const ssize_t len = readv(m_fd, iov, 2); 
    buf1 = buff1;
    buf2 = buff2;
    writebuff = buff1;
    printf("buff1:%s, buff2:%s", buff1, buff2);
    return len;
}

int HttpConn::Write(int* writeerrorno) {
    ssize_t len = write(m_fd, writebuff, sizeof(writebuff));
    printf("write %s", writebuff);
    return len;
}

bool HttpConn::ToWriteBytes() {
    return true;
}

bool HttpConn::Process() {
    return true;
}

bool HttpConn::IsKeepAlive() {
    return true;
}

void HttpConn::Init(int fd, const sockaddr_in& addr) {

}